#include <iostream>
#include <vector>
using namespace std;

bool isPrime(int n)
{
    for (int i = 2; i <= sqrt(n); i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

string solution(int n, vector<int>& a) {
    // write code here
    if (a.size() == 0)
        return "No"; // placeholder return
    vector<int> vc;
    for (int i = 0; i < a.size(); i++)
    {
        if (isPrime(a[i]))
        {
            int count = 0;
            if (vc.size() == 0)
                vc.push_back(a[i]);
            else for (int iii = 0; iii < vc.size(); iii++)
            {
                if (vc[iii] == a[i])
                    break;
                count++;
                if (count == vc.size())
                    vc.push_back(a[i]);
            }
        }
        else for (int ii = 2; ii < a[i]; ii++)
             {
                if (isPrime(ii) && a[i] % ii == 0)
                {
                    int count = 0;
                    if (vc.size() == 0)
                        vc.push_back(ii);
                    else for (int iii = 0; iii < vc.size(); iii++)
                        {
                            if (vc[iii] == ii)
                                break;
                            count++;
                            if (count == vc.size())
                            vc.push_back(ii);
                        }
                }
        }
    }
    if (vc.size() <= n)
        return "Yes";
    return "No";
}

int main() {
    /*vector<int> a1 = { 1, 2, 3, 4 };
    vector<int> a2 = { 10, 12 };
    vector<int> a3 = { 6, 9, 15 };*/
    /*cout << (solution(4, a1) == "Yes") << endl;
    cout << (solution(2, a2) == "No") << endl;
    cout << (solution(3, a3) == "Yes") << endl;*/
    /*vector<int> a4 = { 14, 3 };
    cout << (solution(2, a4) == "No") << endl;*/
    vector<int> a4 = { 16, 6, 1, 13, 11, 1 };
    cout << (solution(6, a4) == "Yes") << endl;
    return 0;
}